package com.mingqi.enetconnected.util.resource;

import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.mingqi.enetconnected.base.MyApplication;

/**
 * Created by li on 2018/8/10.
 * WeChat 18571658038
 * author LiWei
 */

public class ResourceUtils {

    public static String getString(Integer resID){

        String string = MyApplication.sContext.getString(resID);
        return string;
    }

    public static int  getColor(Integer resID){

        int color = MyApplication.sContext.getResources().getColor(resID);
        return color;
    }

    public static View getLayoutView(Integer resID){

        View view = LayoutInflater.from(MyApplication.sContext).inflate(resID, null);
        return view;
    }

    public static View getViewFollowParent(Integer resID,ViewGroup parent){

        View view = LayoutInflater.from(MyApplication.sContext).inflate(resID, parent,false);
        return view;
    }

    public static int getDimen(Integer resID){

        int dimen = MyApplication.sContext.getResources().getDimensionPixelOffset(resID);

        return dimen;
    }

    public static Drawable getDrawable(Integer resID){

        Drawable drawable = MyApplication.sContext.getResources().getDrawable(resID);

        return drawable;
    }
}
